package com.example.qxfw.tourqx.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.example.qxfw.common.entity.zy.SpecialFcst;
import com.example.qxfw.tourqx.mapper.SpecialFcstMapper;
import com.example.qxfw.tourqx.service.SpecialFcstService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SpecialFcstServiceImpl implements SpecialFcstService {

    @Autowired
    private SpecialFcstMapper specialFcstMapper;

    @Override
    public List<SpecialFcst> getList(String dateTime1, String dateTime2, String typeNames, String stationId) {
        return specialFcstMapper.selectList(Wrappers.<SpecialFcst>lambdaQuery()
                .between(SpecialFcst::getDatetime,dateTime1,dateTime2)
                .in(typeNames!=null&&!typeNames.equals(""),SpecialFcst::getTypename,typeNames)
                .likeRight(stationId!=null&&!stationId.equals(""),SpecialFcst::getStationid,stationId)
                .orderByAsc(SpecialFcst::getType)
                .orderByDesc(SpecialFcst::getDatetime));
    }
}
